package me.zhengjie.modules.management.rest.admin;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import me.zhengjie.annotation.Log;
import me.zhengjie.modules.management.domain.MrNotice;
import me.zhengjie.modules.management.domain.Pageable;
import me.zhengjie.modules.management.service.MrNoticeService;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;

/**
 * @website https://docs.auauz.net
 * @Description:
 * @Auther: chao.ji
 * @Date: 2020/12/15
 */
@RestController
@RequiredArgsConstructor
@Api(tags ="MR:公告信息")
@RequestMapping("/api/Notice")
public class MrNoticeController {
    private final MrNoticeService mrNoticeService;
    @PostMapping
    @Log("新增公告信息")
    @ApiOperation("新增公告信息")
    public void addMrNotice(@RequestBody @Valid MrNotice mrNotice){
        mrNoticeService.addNotice(mrNotice);
    }

    @DeleteMapping
    @Log("删除公告信息")
    @ApiOperation("删除公告信息")
    public void deleteMrNotice(@RequestBody List<Integer> ids){
        mrNoticeService.deleteNotice(ids);
    }

    @PutMapping
    @Log("更新公告信息")
    @ApiOperation("更新公告信息")
    public void updateMrNotice(@RequestBody @Valid MrNotice mrNotice){
        mrNoticeService.updateNotice(mrNotice);
    }

    @GetMapping
    @Log("查询公告信息")
    @ApiOperation("查询公告信息")
    public Object queryMrNotice(Pageable pageable){
        return mrNoticeService.queryNotice(pageable);
    }
}
